Skip to content

Remove unneeded anchor events #24474

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

CraigMacomber
Copy link
Contributor

Description

Remove unneeded anchor events

Reviewer Guidance

The review process is outlined on this wiki page.

@Copilot Copilot AI review requested due to automatic review settings April 28, 2025 22:17
@CraigMacomber CraigMacomber requested a review from a team as a code owner April 28, 2025 22:17
@github-actions github-actions bot added area: dds Issues related to distributed data structures area: dds: tree base: main PRs targeted against main branch labels Apr 28, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes unneeded anchor event callbacks to simplify the AnchorSet API and associated tests. The changes include updating test cases to no longer subscribe to and log events for childrenChanged and subtreeChanging, and refactoring the AnchorSet implementation to stop emitting these events.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/dds/tree/src/test/tree/anchorSet.spec.ts Updated test title and callbacks to remove childrenChanged and subtreeChanging expectations.
packages/dds/tree/src/test/shared-tree/treeCheckout.spec.ts Removed subscription and log verification for subtreeChanging events.
packages/dds/tree/src/core/tree/anchorSet.ts Removed event definitions and emission for childrenChanged, subtreeChanging, and subtreeChanged events.
Comments suppressed due to low confidence (3)

packages/dds/tree/src/test/tree/anchorSet.spec.ts:449

  • Ensure that the test expectations and log assertions correctly reflect the current behavior now that 'childrenChanged' and 'subtreeChanging' events have been removed.
it("triggers childrenChanging, treeChanging, and afterDestroy callbacks", () => {

packages/dds/tree/src/test/shared-tree/treeCheckout.spec.ts:90

  • Verify that all log expectations have been updated to exclude references to the removed 'subtreeChanging' events so that the test accurately reflects the new event behavior.
const unsubscribe = anchorNode.events.on("childrenChanging", () => log.push("change"));

packages/dds/tree/src/core/tree/anchorSet.ts:747

  • Confirm that removing the fallback emission on 'childrenChanging' (which previously used an alternative event emitter) will not negatively affect dependent logic expecting a fallback path.
this.maybeWithNode((p) => p.events.emit("childrenChanging", p));

@CraigMacomber CraigMacomber marked this pull request as draft May 22, 2025 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: dds: tree area: dds Issues related to distributed data structures base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants